package open3366pvp.as3.dataStruct
{
	import flash.utils.ByteArray;
	
	import open3366pvp.as3.Open3366PvpEvent;
	
	/**
	 * 服务器主动推送过来的信息 
	 * @author mandyxiong
	 * 
	 */	
	public class ServerMsg implements IPvpInfo
	{
		public var msgFlag:int;//0,服务器转发的消息来自用户  1,退出桌子的通知消息  2别的地方登录，被踢下线  3 用户下线通知（即用户退出区）
		public var srcUid:String;
		public var gameId:int;
		public var zoneId:int;
		public var contentSize:int;
		public var content:ByteArray
		
		public function parasData(data:ByteArray):void
		{
			msgFlag = data.readInt();
			srcUid = data.readUTFBytes(32);
			gameId = data.readUnsignedInt();
			zoneId = data.readInt();
			contentSize = data.readInt();
			content = new ByteArray();
			if(contentSize != 0)
			{
				data.readBytes(content, 0, contentSize);
			}
		}
		
		public function get eventType():String
		{
			return Open3366PvpEvent.SERVER_MESSAGE;
		}
		
		public function toString():String
		{
			return "服务器主动推动的消息，包括透传！！！ \n msgFlag:" + 
				msgFlag + ", srcUid：" + srcUid + ", gameId：" + gameId + 
				", zoneId：" + zoneId + "\n content：" + content.toString();
		}
	}
}